Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use current time as start time for OMTG #6353

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

FSchumacher
Copy link
Contributor

Description

Use current time as of actually starting the open model thread group

Motivation and Context

When we use the test start time via JMeterContextService#getTestStartTime, we might create a storm of test samples at the beginning, when a setup thread group made us wait.

Related to #6352

How Has This Been Tested?

Used the test plan attached and looked at the req/s values. They should be in the range of 1 req/s.
omtg-and-setup-group.jmx.zip

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • Might be a Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist:

  • My code follows the code style of this project.
  • I have updated the documentation accordingly.

@@ -204,7 +204,7 @@ public class OpenModelThreadGroup :
val seed = randomSeed
val rnd = if (seed == 0L) Random() else Random(seed)
val gen = ThreadScheduleProcessGenerator(rnd, parsedSchedule)
val testStartTime = JMeterContextService.getTestStartTime()
val testStartTime = System.currentTimeMillis()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have something like "setup completed timestamp" or "main test started (excluding setup)"?

Copy link
Contributor Author

@FSchumacher FSchumacher Sep 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not aware of such a thing.

But do you think this is needed? ThreadGroup#start gets called, when the thread group should start, so this seems to be enough (for now?).

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

JMeterContextService.getTestStartTime is used in ConstantThroughputTimer, PreciseThroughputTimer.
I expect the classes will have the same issue regarding long setup thread groups.
At the same time, all of those might appear under setup thread groups as well. WDYT of using something like "thread group start time"?

Of course, for OMTG it is a bit easier as start corresponds to the thread group start, however, the timers should probably refer to the start time of the corresponding thread groups.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, if they use the same timestamp to calculate the beginning of the thread group, they are misled, too.

Do the timers have access to their respective thread groups?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's JMeterContextService.getContext().getThreadGroup().
However, AbstractThreadGroup does not track its start time :-/

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could add a setStartTime/getStartTime pair on the AbstractThreadGroup and set the start time before JMeter calls ThreadGroup#start.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It sounds like a good plan.

ConstantThroughputTimer has "shared" mode which means it somehow operates across the thread groups, so I am not sure which "start" timestamp it should use then.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, there has to be done more logic in the ConstantThrouputTimer. The delay has to be calculated depending on the mode. So I left it out now, but it could be added later.

Copy link
Collaborator

@vlsi vlsi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

When we use the test start time via JMeterContextService#getTestStartTime,
we might create a storm of test samples at the beginning, when a setup thread group
made us wait.
…roughputTimer

A thread group might start later than the test. When we calculate delays on the start time of
the test, we might get a stampede of samples run at the start of the thread group.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants